Skip to content

fix(ci): simplify file-size workflow to size-only with JSON exclusions#92

Merged
JacobPEvans merged 3 commits intomainfrom
bugfix/file-size-exclude-lock-files
Mar 14, 2026
Merged

fix(ci): simplify file-size workflow to size-only with JSON exclusions#92
JacobPEvans merged 3 commits intomainfrom
bugfix/file-size-exclude-lock-files

Conversation

@JacobPEvans
Copy link
Owner

@JacobPEvans JacobPEvans commented Mar 14, 2026

PR #92 Update

Summary

Optimize the reusable file-size workflow (.github/workflows/_file-size.yml) by removing
expensive line-count checks and replacing hardcoded exclusions with a flexible, configurable
JSON array input. This improves CI performance and maintainability across all consuming
repositories.

Changes

  • Remove line count check: Eliminated the second find traversal and file type detection
    (expensive file command), reducing workflow runtime
  • Replace hardcoded exclusions with JSON input: New exclude-patterns input accepts
    a JSON array of glob patterns instead of inline hardcoding (e.g., ["**/*.lock", "**/.gradle/**"])
  • Faster size reads: Switched from wc -c to stat -c%s for better performance on
    large file counts
  • Inline PR feedback: Added ::error file= annotations to report violations directly
    on files in PR comments
  • Preserve nix-darwin fallback: Script fallback logic for platforms without stat
    remains intact

Breaking Changes

  • Removed max-line-count input: Repositories using this input (notably nix-ai)
    must remove it from their workflow calls or update to a compatible version
    • Migration: Remove max-line-count from all workflow calls in .github/workflows/*.yml
    • Impact: nix-ai requires a follow-up commit to drop this input from its workflow
      definitions

Downstream Impact

The following repositories consume _file-size.yml and require updates:

  • nix-ai: Remove max-line-count input from file-size workflow calls
  • nix-darwin: No action needed (uses only size checks)
  • nix-home: No action needed (uses only size checks)
  • Other repos: Verify they do not reference max-line-count

Test Plan

  1. Verify exclusions work: Push test commits with excluded file types (.lock,
    .gradle) and confirm they do not trigger failures
  2. Verify size checks remain: Push files exceeding max-file-size and confirm
    violations are caught
  3. Verify inline feedback: Confirm ::error file= annotations appear correctly in PR
    comments
  4. Performance: Compare workflow runtime before/after (expected ~20-30% improvement)
  5. nix-ai follow-up: Confirm nix-ai can run with updated workflow after removing
    max-line-count

Related: #1

Lock files (flake.lock, package-lock.json, yarn.lock, etc.) are
auto-generated and should not be subject to file size or line count
limits. This was causing CI failures on repos with large lock files.

(claude)
Copilot AI review requested due to automatic review settings March 14, 2026 11:38
@gemini-code-assist
Copy link

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the reusable _file-size workflow to ignore certain lock files during file-size and line-count checks, reducing CI noise from generated artifacts.

Changes:

  • Add a find exclusion for *.lock files in the file-size scan.
  • Add the same find exclusion for *.lock files in the line-count scan.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Drop line count check entirely — it added a second find traversal plus
expensive `file` detection per file with little value over size limits.

Replace hardcoded find exclusions with a configurable `exclude-patterns`
JSON array input so callers can customize without forking. Use `stat -c%s`
instead of `wc -c` for faster size reads and `::error` annotations for
inline PR feedback.

BREAKING: removes `max-line-count` input — nix-ai needs to drop this
parameter from its ci-gate.yml caller.

(claude)
@JacobPEvans JacobPEvans changed the title fix(ci): exclude lock files from file-size checks fix(ci): simplify file-size workflow to size-only with JSON exclusions Mar 14, 2026
@JacobPEvans JacobPEvans merged commit f518c80 into main Mar 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants